From 753f159aad956de1455f5d7c0b2cd8b79a7fb7f5 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 4 Sep 2009 13:10:35 +0200 Subject: [PATCH] Don't access region when it might be freed Passing region into _gdk_gc_set_clip_region_internal takes ownership, so don't use it after that. We can just as well just move the usage above the call. --- gdk/gdkwindow.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index a673be78e4..3f27f9a702 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -2528,6 +2528,9 @@ gdk_window_flush_implicit_paint (GdkWindow *window) if (!gdk_region_empty (region)) { + /* Remove flushed region from the implicit paint */ + gdk_region_subtract (paint->region, region); + /* Some regions are valid, push these to window now */ tmp_gc = _gdk_drawable_get_scratch_gc ((GdkDrawable *)window, FALSE); _gdk_gc_set_clip_region_internal (tmp_gc, region, TRUE); @@ -2535,9 +2538,6 @@ gdk_window_flush_implicit_paint (GdkWindow *window) 0, 0, paint->x_offset, paint->y_offset, -1, -1); /* Reset clip region of the cached GdkGC */ gdk_gc_set_clip_region (tmp_gc, NULL); - - /* Remove flushed region from the implicit paint */ - gdk_region_subtract (paint->region, region); } else gdk_region_destroy (region); -- 2.30.2